package cn.xuexiyuan.flinkstudy.source;

import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @Description:
 * @Author 左龙龙
 * @Date 21-3-23
 * @Version 1.0
 **/
public class SourceDemo02_File {
    public static void main(String[] args) throws Exception {
        // 0.env
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        // 1.source
        // env.readTextFile(本地文件/本地文件夹/HDFS/压缩文件)
        DataStreamSource<String> ds1 = env.readTextFile("data/input/word1.txt");
        DataStreamSource<String> ds2 = env.readTextFile("data/input");
        DataStreamSource<String> ds3 = env.readTextFile("data/input/word3.txt.tar.gz");

        // 2.transformation

        // 3.sink
        ds1.print();
        ds2.print();
        ds3.print();

        // 4.excute
        env.execute("SourceDemo02_File");


    }
}
